<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/connopen.asp"-->
<!--#include file="lib/asp-common-lib.asp"-->
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CC的办公系统</title>
<!--#include file="lib/plugins.asp"-->
<style type="text/css">
    .ui-datepicker table {
        border: 0;
    }
    .ui-autocomplete-loading { 
        background: white url('images/ui-anim_basic_16x16.gif') left center no-repeat; 
    }
    .ui-autocomplete,.ui-menu-item .ui-corner-all {
            border-radius: 0;
    }
    thead th{
        text-align:center;
        background:#e0e0e0;
    }
    tbody th[scope="row"],tbody th.sub{
        text-align:center;
    }
    input,select{
        border:1px solid #888888;
    }
    input:hover,input:active,select:hover,select:active{
        border:1px solid #aa6666
    }
    input[type=text]{
        padding:2px;
        margin:1px 0;
    }
    #pagebar{
        float:right;
    }
    #search_bar{
        border-width:1px 0;
    }
    #search_bar td{
        padding:1px;
        border-width:0;
    }
    #search_bar tr:hover td{
        background:#fff;
    }
    .bt_button{
    cursor: pointer;
    overflow: visible;
    width: auto;
    background: url("lib/yaml/screen/images/button_gray.png") repeat-x scroll left top #454545;
    border-color: #DDDDDD #444444 #444444 #DDDDDD;
    border-style: solid;
    border-width: 1px;
    color: #000000;
    padding: 5px 1em;    
    }
    .bt_button:hover,.bt_button:active,.bt_button:focus{
    background: none repeat-x scroll left top #555555;
    border-color: #444444 #DDDDDD #DDDDDD #444444;
    color: #ffffff;
    }
    #page_go,#report_search,.bt_act{
        padding:0;
    }
    .chk{
        background-color:#d0d0d0;
    }
    #diaglog_report{
        display:none;
    }
    #lb_search{
        //width:5em;
    }
    #bts_search{
        width:11.9em;
        text-align:right;
    }
    #adv_search{
        display:none;
    }
</style>
<script type="text/javascript">
    $(function() {
        $.ajaxSetup ({
            cache: false, //关闭AJAX相应的缓存
            beforeSend:function() {
                $("#search_bar .ui-widget").addClass( "ui-autocomplete-loading" );
                $("#bt_search").attr("disabled",true);
            },
            complete:function() {
                $("#search_bar .ui-widget").removeClass( "ui-autocomplete-loading" );
                $("#bt_search").attr("disabled",false);
            }
        });
        $(".datepicker").datepicker({ maxDate: 0 });
        var p=1;
        function vi(p){
            $.get("searchoffer_main.asp?page="+p+"&"+$("#fm_search").serialize(),function(data){    //用ajax的get方式提交
                $("#search_main").html(data);

                $("#pagebar a").click(function(e){    //对分页栏中的a元素进行操作
                    e.preventDefault();    //阻止a的原先事件
                    vi($(this).attr("id"));    //根据获取的页码值调用显示页面函数
                });
                $("#page_go").click(function(e){    //对分页栏中的input元素进行操作
                    e.preventDefault();
                    if (isNaN($("#page_val").val())||$.trim($("#page_val").val())==""){    //判断输入的是否是数字
                        alert("输入的页码错误，请输入正确页码！");
                        $("#page_val").select();
                        return false;    //页码值不是数字则退出；
                    }
                    vi($("#page_val").val());
                });
                var chk=$(".checkid");
                $("#checkall").click(function(){
                  chk.prop("checked",$(this).prop("checked"));//根据全选的checkbox状态来填充单个checkbox状态
                  $(this).prop("checked") ? chk.closest("tr").addClass("chk") : chk.closest("tr").removeClass("chk")//判断是否全部选中，选中则增加chk样式，没选中则删除chk样式，不能用toggleClass方法，由于下面单个checkbox会改变全选的checkbox状态
                });
                chk.click(function(){
                  if(!$(this).prop("checked")) $("#checkall").prop("checked",false);//如果当前checkbox状态为未选中则全选的checkbox也设置为未选中
                  $(this).closest("tr").toggleClass("chk");//单个切换当前checkbox存在的tr的chk样式
                });
                
                $("#delid").click(function(){
                  $chks=$("#search_main input:checkbox.checkid:checked");
                  if(confirm("要删除这 "+$chks.length+" 条记录吗？")){
                    var aChk=new Array();
                    $chks.each(function(){
                      aChk.push($(this).val());
                    });
                    $.post("deloffer.asp",{chks:aChk.join(),act:$("#delid").val()},function(data){
                      if(data.bStatus){
                        alert("删除成功！");
                        vi($("#page_val").val());
                      }else{
                        alert(data.sInfo);
                      }
                    },"json");
                  }
                });
                
            });

        }
        $("#bt_search").click(function(){
            var start_time = new Date().getTime();
            vi(p);
            var end_time = new Date().getTime();
            $("#show_runtime").html(end_time-start_time);
        });
        vi(p);
        $("#fm_search select").change(function(){
            vi(p);
        });
        $( "#diaglog_report" ).dialog({
            autoOpen: false,
            width:280,
            modal: true,
            //position: 'center',
            buttons: {
                "生成": function() {
                    window.open('searchoffer_report.asp?'+$("#fm_search").serialize()+'&'+$("#fm_report").serialize(), '_blank', 'height=768px, width=1024px, scrollbars=yes, resizable=yes');
                },
                "取消": function() {
                    $(this).dialog( "close" );
                }

            }

        });
        $("#report_search").live('click',function(){
            $( "#diaglog_report" ).dialog("open");
        });
        
    });
</script>
<!--#include file="lib/js-google-analytics.asp"-->
</head>
<%
if not CheckPostFlag(session("aaPostFlag"),3,2) then call JumpErrorPage(2)
%>
<body>
<div id="diaglog_report" title="生成报表">
    <form id="fm_report" name="fm_report">
        <div class="type-text">
            <input id="report_title" name="report_title" type="text" size="30" value="<%=year(date())%>年<%if month(date())<7 then response.write "下" else response.write "上"%>半年文具用品分摊表" />
        </div>
    </form>
</div>
<!--#include file="lib/header.asp"-->
<!--#include file="lib/nav.asp"-->
<div id="main">
<!--#include file="lib/col1.asp"-->
<!--#include file="lib/col2.asp"-->
    <div id="col3" role="main">
        <div id="col3_content" class="clearfix">
            <form id="fm_search" name="fm_search">
                <table id="search_bar" class="full">
                    <tr>
                        <td id="lb_search">
                            <label for="tx_search">查询内容：</label>
                            <input id="tx_search" name="tx_search" type="text" />
                                领用日期
                                <input name="ksrq" id="ksrq" class="datepicker" type="text" size="10" maxlength="10" />-<input name="jsrq" id="jsrq" class="datepicker" type="text" size="10" maxlength="10" />
                    <select id="offer_empe" name="offer_empe">
                        <option value="">选择员工</option>
                    <%
                        Set rs_empe = Server.CreateObject("ADODB.Recordset")
                        sql_empe = "SELECT * FROM empe order by empe_name"
                        rs_empe.Open sql_empe,conn,1,1
                        do while not rs_empe.eof
                    %>
                        <option value="<%=rs_empe("empe_id")%>"><%=rs_empe("empe_name")%></option>
                    <%
                            rs_empe.movenext
                        loop
                        rs_empe.close
                        set rs_empe=nothing
                    %>
                    </select>
                    <select id="offer_dept" name="offer_dept">
                        <option value="">选择部门</option>
                    <%
                        Set rs_dept = Server.CreateObject("ADODB.Recordset")
                        sql_dept = "SELECT * FROM dept order by dept_name"
                        rs_dept.Open sql_dept,conn,1,1
                        do while not rs_dept.eof
                    %>
                        <option value="<%=rs_dept("dept_id")%>"><%=rs_dept("dept_name")%></option>
                    <%
                            rs_dept.movenext
                        loop
                        rs_dept.close
                        set rs_dept=nothing
                    %>
                    </select>
                            <select id="class_id" name="class_id">
                                <option value="">选择分类</option>
                            <%
                                Set rs_class = Server.CreateObject("ADODB.Recordset")
                                sql_class = "SELECT * FROM class order by class_name"
                                rs_class.Open sql_class,conn,1,1
                                do while not rs_class.eof
                            %>
                                <option value="<%=rs_class("class_id")%>"><%=rs_class("class_name")%></option>
                            <%
                                    rs_class.movenext
                                loop
                                rs_class.close
                                set rs_class=nothing
                            %>
                            </select>
                            <select id="vendor_id" name="vendor_id">
                                <option value="">选择供应商</option>
                            <%
                                Set rs_vendor = Server.CreateObject("ADODB.Recordset")
                                sql_vendor = "SELECT * FROM vendor order by vendor_name"
                                rs_vendor.Open sql_vendor,conn,1,1
                                do while not rs_vendor.eof
                            %>
                                <option value="<%=rs_vendor("vendor_id")%>"><%=rs_vendor("vendor_name")%></option>
                            <%
                                    rs_vendor.movenext
                                loop
                                rs_vendor.close
                                set rs_vendor=nothing
                            %>
                            </select>
                            <select id="offer_bill" name="offer_bill">
                                <option value="">是否结算</option>
                                <option value="false">未结算</option>
                                <option value="true">已结算</option>
                            </select>
                            <select id="search_count" name="search_count">
                                <option value="100">最新100条</option>
                                <option value="">全部</option>
                            </select>
                        </td>
                        <td id="bts_search">
                            <div class="ui-widget">
                            <input id="bt_search" class="bt_button" name="bt_submit" type="button" value="搜索" />
                            <input class="bt_button" type="reset" value="重置" />
                            </div>
                        </td>
                    </tr>
                </table>
            </form>        
            <div id="search_main"></div>
        </div>
    </div>
</div>
<!--#include file="lib/footer.asp"-->
</body>
</html>
<!--#include file="lib/connclose.asp"-->

